package cn.it62.pojo;


import java.util.Scanner;

/**
 * @author geQiang
 * @version 1.0
 * @date 2019/7/24
 * @description cn.it62.pojo
 */
public class Visitor {
    public String name;
    public int age;
    public Scanner sc = new Scanner(System.in);
    public static final double PRICE = 20;

    public void buyTicket(){
        while (true){
            System.out.println("输入姓名：");
            name = sc.next();
            if("n".equals(name)){
                System.out.println("退出程序！");
                break;

            }
            System.out.println("输入年龄：");
            //输入异常
            age = sc.nextInt();
            if(age > 60|| age < 18){
                System.out.println(name+"的年龄是"+age+"免票");
            }else{
                System.out.println(name+"的年龄是"+age+"门票"+PRICE+"元");


            }
        }
    }
}













